#ifndef AUTOMATON_HYBRID_ENCODER_HPP 
#define AUTOMATON_HYBRID_ENCODER_HPP

#include "Slaves/general/generalPrototype.hpp"
#include <vector>
#include <string>

typedef float(__stdcall* SimuPositionSensorReadCall)(std::wstring sensorName, std::wstring motorName, int axisIndex);

struct PositionSensor :GeneralSlave {
	PositionSensor(GeneralSlave* ref);
	~PositionSensor();

	struct RobotAxis {
		std::wstring slaveRefName;
		int axisIndex = -1;

		// must be set
		SimuPositionSensorReadCall simuCallback = NULL;
	};
	RobotAxis _measuredRobot;

	struct PositionReading {
		float positionMM;
		std::vector<uint16_t> sensorData;
		int reliable = -1;
		clock_t readOutTimeMs;
		int set(float val);
		int parse(std::string reply);
		~PositionReading();
	};
	//std::vector<PositionReading> _readings;
	PositionReading _reading;

	// a quick readout
	int readOut(uint64_t loopIndex = 0) override;

	int readOutDebugDetail();
	// cannot be used in motion
	int readOutInIdle(uint64_t loopIndex) override;


};

#endif